package com.lan.test01;

import com.lan.domain.Student;

public class Test01 {
    public static void main(String[] args) throws ClassNotFoundException {
        //类名.class属性
        Class clazz = Student.class;
        System.out.println(clazz);//class com.lan.domain.Student

        //对象名.getClass()方法
        Student stu = new Student();
        Class clazz1 = stu.getClass();
        System.out.println(clazz1);//class com.lan.domain.Student

        //Class.forName(全类名) 方法
        Class clazz2 = Class.forName("com.lan.domain.Student");
        System.out.println(clazz2);//class com.lan.domain.Student

        //一个类只有一个类对象，是唯一的
        System.out.println(clazz == clazz1);//true
        System.out.println(clazz1 == clazz2);//true
    }
}
